package com.ccntec.spark.core.tags.panel;

import javax.servlet.jsp.JspException;

import com.ccntec.spark.core.BasicTagSupport;


public class PanelTag extends BasicTagSupport {
	
	private String icon ;
	private String iconSize ;
	private String iconColor ;
	private String text ;
	//private boolean padded ;
	
	/*<div class="row">
			<div class="col-lg-12">
				<div class="widget-container fluid-height clearfix">
					<div class="heading">
						<i class="icon-home" style="font-size:27px;color: purple;"></i>日期选择器
					</div>
					<div class="widget-content padded">
					</div>
				</div>
			</div>
		</div>*/
	
	@Override
	public int doStartTag() throws JspException {
		StringBuffer html = new StringBuffer();
		StringBuffer style = new StringBuffer();
		style.append("style=\"");
		if(!isNull(iconSize)){
			style.append("font-size:"+iconSize+";");
		}
		if(!isNull(iconColor)){
			style.append("color: "+iconColor+";");
		}
		style.append("\"");
		html.append("<div class=\"row\">\n<div class=\"col-lg-12\">\n");
		html.append("<div class=\"widget-container fluid-height clearfix\">\n");
		html.append("<div class=\"heading\">");
		html.append("<i class=\"icon-"+icon+"\" "+style+" ></i>");
		if(!isNull(text)){
			html.append(text);
		}
		html.append("</div>\n");
		html.append("<div class=\"widget-content padded\">\n");
		outPrint(html);
		return EVAL_BODY_INCLUDE;
	}
	
	@Override
	public int doAfterBody() throws JspException {
		return SKIP_BODY;
	}
	
	@Override
	public int doEndTag() throws JspException {
		StringBuffer html = new StringBuffer();
		html.append("</div>\n");
		html.append("</div>\n</div>\n</div>\n");
		outPrint(html);
		return EVAL_PAGE;
	}
	
	@Override
	public void release() {
		// TODO Auto-generated method stub
		super.release();
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public void setIconSize(String iconSize) {
		this.iconSize = iconSize;
	}

	public void setIconColor(String iconColor) {
		this.iconColor = iconColor;
	}

	public void setText(String text) {
		this.text = text;
	}
}
